
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>适配器模式 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../../../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../../../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../../../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../bridgemode/" />
    
    
    <link rel="prev" href="../proxymode/" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../../../../">
            
                <a href="../../../../../../">
            
                    
                    说明
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../../../../../">
            
                <a href="../../../../../">
            
                    
                    设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" >
            
                <span>
            
                    
                    创建型模式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1.1" >
            
                <span>
            
                    
                    简单工厂模式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.2" >
            
                <span>
            
                    
                    工厂方法模式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.3" data-path="../../createdmodel/abstractfactorymode/">
            
                <a href="../../createdmodel/abstractfactorymode/">
            
                    
                    抽象工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.4" data-path="../../createdmodel/bulidermode/">
            
                <a href="../../createdmodel/bulidermode/">
            
                    
                    建造者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.5" data-path="../../createdmodel/prototypemode/">
            
                <a href="../../createdmodel/prototypemode/">
            
                    
                    原型模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.6" data-path="../../createdmodel/singletonmode/">
            
                <a href="../../createdmodel/singletonmode/">
            
                    
                    单例模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../">
            
                <a href="../">
            
                    
                    结构型模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.2.1" data-path="../proxymode/">
            
                <a href="../proxymode/">
            
                    
                    代理模式
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.1.2.2" data-path="./">
            
                <a href="./">
            
                    
                    适配器模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.3" data-path="../bridgemode/">
            
                <a href="../bridgemode/">
            
                    
                    桥接模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.4" data-path="../decoratormode/">
            
                <a href="../decoratormode/">
            
                    
                    装饰模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.5" data-path="../facademode/">
            
                <a href="../facademode/">
            
                    
                    外观模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.6" data-path="../flyweightmode/">
            
                <a href="../flyweightmode/">
            
                    
                    享元模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.7" data-path="../compositemode/">
            
                <a href="../compositemode/">
            
                    
                    组合模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../../behavioralmodel/">
            
                <a href="../../behavioralmodel/">
            
                    
                    行为型模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.3.1" data-path="../../behavioralmodel/templatemethodmode/">
            
                <a href="../../behavioralmodel/templatemethodmode/">
            
                    
                    模板方法模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.2" data-path="../../behavioralmodel/strategymode/">
            
                <a href="../../behavioralmodel/strategymode/">
            
                    
                    策略模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.3" data-path="../../behavioralmodel/commandmode/">
            
                <a href="../../behavioralmodel/commandmode/">
            
                    
                    命令模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.4" data-path="../../behavioralmodel/chainofresponsibility/">
            
                <a href="../../behavioralmodel/chainofresponsibility/">
            
                    
                    责任链模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.5" data-path="../../behavioralmodel/statemode/">
            
                <a href="../../behavioralmodel/statemode/">
            
                    
                    状态模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.6" data-path="../../behavioralmodel/observermode/">
            
                <a href="../../behavioralmodel/observermode/">
            
                    
                    观察者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.7" data-path="../../behavioralmodel/mediatormode/">
            
                <a href="../../behavioralmodel/mediatormode/">
            
                    
                    中介者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.8" data-path="../../behavioralmodel/iteratormode/">
            
                <a href="../../behavioralmodel/iteratormode/">
            
                    
                    迭代器模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.9" data-path="../../behavioralmodel/visitormode/">
            
                <a href="../../behavioralmodel/visitormode/">
            
                    
                    访问者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.10" data-path="../../behavioralmodel/mementomode/">
            
                <a href="../../behavioralmodel/mementomode/">
            
                    
                    备忘录模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.11" data-path="../../behavioralmodel/interpretermode/">
            
                <a href="../../behavioralmodel/interpretermode/">
            
                    
                    解释器模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../../../../../../Nacos/">
            
                <a href="../../../../../../Nacos/">
            
                    
                    Nacos
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../../../../../../Nacos/Nacos-Introduction.html">
            
                <a href="../../../../../../Nacos/Nacos-Introduction.html">
            
                    
                    Nacos介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../../../../../../Nacos/Nacos-Registration.html">
            
                <a href="../../../../../../Nacos/Nacos-Registration.html">
            
                    
                    Nacos注册中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../../../../../../Nacos/Nacos-OpenFeign.html">
            
                <a href="../../../../../../Nacos/Nacos-OpenFeign.html">
            
                    
                    Nacos+OpenFeign
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../../../../../Sortings/">
            
                <a href="../../../../../../Sortings/">
            
                    
                    排序算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../../../../../../Sortings/src/main/java/com/larscheng/www/InsertionSort/">
            
                <a href="../../../../../../Sortings/src/main/java/com/larscheng/www/InsertionSort/">
            
                    
                    插入排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../../../../../../Sortings/src/main/java/com/larscheng/www/shellSort/">
            
                <a href="../../../../../../Sortings/src/main/java/com/larscheng/www/shellSort/">
            
                    
                    希尔排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3" >
            
                <span>
            
                    
                    选择排序
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4" >
            
                <span>
            
                    
                    堆排序
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5" >
            
                <span>
            
                    
                    希尔排序
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../../../../.." >适配器模式</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;">&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;</h3>
<p>&#x5C06;&#x4E00;&#x4E2A;&#x7C7B;&#x7684;&#x63A5;&#x53E3;&#x8F6C;&#x6362;&#x4E3A;&#x8C03;&#x7528;&#x65B9;&#x5E0C;&#x671B;&#x7684;&#x53E6;&#x4E00;&#x4E2A;&#x63A5;&#x53E3;&#xFF0C;&#x662F;&#x7684;&#x539F;&#x672C;&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x63A5;&#x53E3;&#x53D8;&#x5F97;&#x53EF;&#x517C;&#x5BB9;&#x5171;&#x540C;&#x5DE5;&#x4F5C;</p>
<p>&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#x5206;&#x4E3A;&#x4E24;&#x79CD;&#xFF1A;</p>
<ul>
<li>&#x7C7B;&#x7ED3;&#x6784;&#x578B;&#x6A21;&#x5F0F; &#xFF1A;&#x7C7B;&#x4E4B;&#x95F4;&#x8026;&#x5408;&#x5EA6;&#x8F83;&#x9AD8;&#xFF0C;&#x4F7F;&#x7528;&#x8981;&#x6C42;&#x76F8;&#x5BF9;&#x8F83;&#x8584;&#xFF0C;&#x4F7F;&#x7528;&#x8F83;&#x5C11;</li>
<li>&#x5BF9;&#x8C61;&#x7ED3;&#x6784;&#x578B;&#x6A21;&#x5F0F; &#xFF1A;&#x666E;&#x904D;&#x4F7F;&#x7528;</li>
</ul>
<p>eg&#xFF1A;</p>
<p>typeC&#x7684;&#x5145;&#x7535;&#x7EBF;&#x4E0D;&#x80FD;&#x7ED9;&#x666E;&#x901A;&#x5B89;&#x5353;&#x673A;&#x5145;&#x7535;&#xFF0C;&#x56E0;&#x4E3A;&#x63A5;&#x53E3;&#x4E0D;&#x517C;&#x5BB9;&#xFF0C;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x4E00;&#x4E2A;&#x8F6C;&#x63A5;&#x5934;&#x9002;&#x914D;&#x5668;&#xFF0C;type&#x8F6C;&#x5B89;&#x5353;&#xFF0C;&#x5373;&#x53EF;&#x5B9E;&#x73B0;&#x5B89;&#x5353;&#x624B;&#x673A;&#x5145;&#x7535;</p>
<p>&#x7528;&#x76F4;&#x6D41;&#x7535;&#x7684;&#x7535;&#x5B50;&#x8BBE;&#x5907;&#x5728;&#x4F7F;&#x7528;&#x4E2D;&#x90FD;&#x4FEE;&#x8981;&#x4E00;&#x4E2A;&#x7535;&#x6E90;&#x9002;&#x914D;&#x5668;&#x5C06;&#x63D2;&#x5EA7;&#x4E0A;&#x7684;&#x4EA4;&#x6D41;&#x7535;&#x8F6C;&#x53D8;&#x4E3A;&#x76F4;&#x6D41;&#x7535;</p>
<p>&#x9700;&#x8981;&#x5F00;&#x53D1;&#x7684;&#x5177;&#x6709;&#x67D0;&#x79CD;&#x4E1A;&#x52A1;&#x529F;&#x80FD;&#x7684;&#x7EC4;&#x4EF6;&#x5728;&#x73B0;&#x6709;&#x7684;&#x7EC4;&#x4EF6;&#x5E93;&#x4E2D;&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x4F46;&#x5B83;&#x4EEC;&#x4E0E;&#x5F53;&#x524D;&#x7CFB;&#x7EDF;&#x7684;&#x63A5;&#x53E3;&#x89C4;&#x8303;&#x4E0D;&#x517C;&#x5BB9;&#xFF0C;
&#x5982;&#x679C;&#x91CD;&#x65B0;&#x5F00;&#x53D1;&#x8FD9;&#x4E9B;&#x7EC4;&#x4EF6;&#x6210;&#x672C;&#x53C8;&#x5F88;&#x9AD8;&#xFF0C;&#x8FD9;&#x65F6;&#x7528;&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#x80FD;&#x5F88;&#x597D;&#x5730;&#x89E3;&#x51B3;&#x8FD9;&#x4E9B;&#x95EE;&#x9898;</p>
<h3 id="&#x4F18;&#x7F3A;&#x70B9;">&#x4F18;&#x7F3A;&#x70B9;</h3>
<p>&#x4F18;&#x70B9;&#xFF1A;</p>
<ul>
<li>&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x8FC7;&#x9002;&#x914D;&#x5668;&#x53EF;&#x4EE5;&#x65E0;&#x969C;&#x788D;&#x8C03;&#x7528;&#x76EE;&#x6807;&#x63A5;&#x53E3;</li>
<li>&#x590D;&#x7528;&#x73B0;&#x5B58;&#x7684;&#x7C7B;&#xFF0C;&#x63D0;&#x9AD8;&#x6548;&#x7387;</li>
<li>&#x76EE;&#x6807;&#x7C7B;&#x4E0E;&#x9002;&#x914D;&#x8005;&#x89E3;&#x8026;</li>
</ul>
<p>&#x7F3A;&#x70B9;&#xFF1A;&#x66F4;&#x6362;&#x9002;&#x914D;&#x5668;&#x8FC7;&#x7A0B;&#x590D;&#x6742;</p>
<h3 id="&#x89D2;&#x8272;">&#x89D2;&#x8272;</h3>
<ul>
<li>&#x76EE;&#x6807;&#x63A5;&#x53E3;&#xFF1A;&#x5F53;&#x524D;&#x7CFB;&#x7EDF;&#x4E1A;&#x52A1;&#x6240;&#x671F;&#x5F85;&#x7684;&#x63A5;&#x53E3;&#xFF0C;&#x62BD;&#x8C61;&#x7C7B;&#x6216;&#x8005;&#x63A5;&#x53E3;</li>
<li>&#x9002;&#x914D;&#x8005;&#x7C7B;&#xFF1A;&#x8981;&#x88AB;&#x9002;&#x914D;&#x7684;&#x7C7B;&#xFF0C;&#x539F;&#x672C;&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x7C7B;</li>
<li>&#x9002;&#x914D;&#x5668;&#x7C7B;&#xFF1A;&#x4E00;&#x4E2A;&#x8F6C;&#x6362;&#x5668;&#xFF0C;&#x901A;&#x8FC7;&#x7EE7;&#x627F;&#x6216;&#x5F15;&#x7528;&#x9002;&#x914D;&#x8005;&#x5BF9;&#x8C61;&#xFF0C;&#x628A;&#x9002;&#x914D;&#x8005;&#x63A5;&#x53E3;&#x8F6C;&#x6362;&#x6210;&#x76EE;&#x6807;&#x63A5;&#x53E3;&#xFF0C;&#x4F7F;&#x5F97;&#x5BA2;&#x6237;&#x6309;&#x7167;&#x76EE;&#x6807;&#x63A5;&#x53E3;&#x7684;&#x683C;&#x5F0F;&#x8BBF;&#x95EE;&#x9002;&#x914D;&#x8005;</li>
</ul>
<p><img src="http://c.biancheng.net/uploads/allimg/181115/3-1Q1151045351c.gif" alt="&#x7C7B;&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#x7684;&#x7ED3;&#x6784;&#x56FE;"></p>
<p><img src="http://c.biancheng.net/uploads/allimg/181115/3-1Q1151046105A.gif" alt="&#x5BF9;&#x8C61;&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#x7684;&#x7ED3;&#x6784;&#x56FE;"></p>
<p>&#x7C7B;&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-comment">/**
* &#x76EE;&#x6807;&#x63A5;&#x53E3;
*/</span>
<span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">Target</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">request</span><span class="hljs-params">()</span></span>;
}

<span class="hljs-comment">/**
* &#x9002;&#x914D;&#x8005;&#x63A5;&#x53E3;
*/</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Adapter</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">Job</span><span class="hljs-params">()</span></span>{
        <span class="hljs-comment">//&#x8C03;&#x7528;&#x6267;&#x884C;&#x5B9E;&#x9645;&#x7684;&#x4E1A;&#x52A1;</span>
        System.out.println(<span class="hljs-string">&quot;&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x4E1A;&#x52A1;&#x529F;&#x80FD;&#x5728;&#x9002;&#x914D;&#x540E;&#x88AB;&#x8C03;&#x7528;&quot;</span>);
    }
}

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ClassAdapter</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Adapter</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">Target</span></span>{

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">request</span><span class="hljs-params">()</span></span>{
        System.out.println(<span class="hljs-string">&quot;&#x3010;&#x7C7B;&#x3011;&#x9002;&#x914D;&#x5668;&#x5F00;&#x59CB;&#x5DE5;&#x4F5C;&#xFF0C;&#x8FDB;&#x884C;&#x517C;&#x5BB9;&#x6027;&#x9002;&#x914D;....&quot;</span>);
        <span class="hljs-keyword">super</span>.Job();
    }
}
</code></pre>
<pre><code>&#x3010;&#x7C7B;&#x3011;&#x9002;&#x914D;&#x5668;&#x5F00;&#x59CB;&#x5DE5;&#x4F5C;&#xFF0C;&#x8FDB;&#x884C;&#x517C;&#x5BB9;&#x6027;&#x9002;&#x914D;....
&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x4E1A;&#x52A1;&#x529F;&#x80FD;&#x5728;&#x9002;&#x914D;&#x540E;&#x88AB;&#x8C03;&#x7528;
</code></pre><p>&#x5BF9;&#x8C61;&#x9002;&#x914D;&#x5668;</p>
<pre><code class="lang-java"><span class="hljs-comment">/**
* &#x76EE;&#x6807;&#x63A5;&#x53E3;
*/</span>
<span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">Target</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">request</span><span class="hljs-params">()</span></span>;
}

<span class="hljs-comment">/**
* &#x9002;&#x914D;&#x8005;&#x63A5;&#x53E3;
*/</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Adapter</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">Job</span><span class="hljs-params">()</span></span>{
        <span class="hljs-comment">//&#x8C03;&#x7528;&#x6267;&#x884C;&#x5B9E;&#x9645;&#x7684;&#x4E1A;&#x52A1;</span>
        System.out.println(<span class="hljs-string">&quot;&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x4E1A;&#x52A1;&#x529F;&#x80FD;&#x5728;&#x9002;&#x914D;&#x540E;&#x88AB;&#x8C03;&#x7528;&quot;</span>);
    }
}
<span class="hljs-comment">/***
* &#x5BF9;&#x8C61;&#x9002;&#x914D;&#x5668;
*/</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ObjectAdapter</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">Target</span></span>{

    <span class="hljs-keyword">private</span> Adapter adapter;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">ObjectAdapter</span><span class="hljs-params">(Adapter adapter)</span></span>{
        <span class="hljs-keyword">this</span>.adapter = adapter;
    }

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">request</span><span class="hljs-params">()</span></span>{
        System.out.println(<span class="hljs-string">&quot;&#x3010;&#x5BF9;&#x8C61;&#x3011;&#x9002;&#x914D;&#x5668;&#x5F00;&#x59CB;&#x5DE5;&#x4F5C;&#xFF0C;&#x8FDB;&#x884C;&#x517C;&#x5BB9;&#x6027;&#x9002;&#x914D;....&quot;</span>);
        adapter.Job();
    }
}
</code></pre>
<pre><code>&#x3010;&#x5BF9;&#x8C61;&#x3011;&#x9002;&#x914D;&#x5668;&#x5F00;&#x59CB;&#x5DE5;&#x4F5C;&#xFF0C;&#x8FDB;&#x884C;&#x517C;&#x5BB9;&#x6027;&#x9002;&#x914D;....
&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x4E1A;&#x52A1;&#x529F;&#x80FD;&#x5728;&#x9002;&#x914D;&#x540E;&#x88AB;&#x8C03;&#x7528;
</code></pre><h3 id="&#x6A21;&#x62DF;&#x573A;&#x666F;">&#x6A21;&#x62DF;&#x573A;&#x666F;</h3>
<p>&#x73B0;&#x5728;&#x7684;app&#x90FD;&#x6709;&#x591A;&#x7AEF;&#x5165;&#x53E3;,app&#x7AEF;,&#x5C0F;&#x7A0B;&#x5E8F;&#x7AEF;
&#x5C31;&#x4EE5;xx&#x5355;&#x8F66;&#x4E3A;&#x4F8B;&#xFF0C;&#x4E00;&#x671F;&#x53EA;&#x5F00;&#x53D1;&#x4E86;app&#x7AEF;,app&#x6709;&#x4E00;&#x4E2A;&#x626B;&#x7801;&#x5F00;&#x9501;&#x7684;&#x63A5;&#x53E3;&#xFF0C;&#x4E8C;&#x671F;&#x5F00;&#x53D1;&#x4E86;&#x5C0F;&#x7A0B;&#x5E8F;&#x7AEF;&#xFF0C;&#x5C0F;&#x7A0B;&#x5E8F;&#x7AEF;&#x4E0A;&#x540C;&#x6837;&#x4E5F;&#x9700;&#x8981;&#x4E00;&#x4E2A;&#x626B;&#x7801;&#x5F00;&#x9501;&#x7684;&#x63A5;&#x53E3;</p>
<p>&#x8FD9;&#x65F6;&#x5019;&#x60F3;&#x8D77;&#x6765;&#x4E00;&#x671F;app&#x4E2D;&#x6709;&#x4E00;&#x4E2A;&#x529F;&#x80FD;&#x76F8;&#x540C;&#x7684;&#x63A5;&#x53E3;&#xFF0C;&#x4F46;&#x662F;&#x5374;&#x53D1;&#x73B0;&#x4E00;&#x671F;&#x7684;&#x53C2;&#x6570;&#x683C;&#x5F0F;&#x548C;&#x76EE;&#x524D;&#x5C0F;&#x7A0B;&#x5E8F;&#x4E0A;&#x7684;&#x53C2;&#x6570;&#x683C;&#x5F0F;&#x4E0D;&#x592A;&#x4E00;&#x6837;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#x9002;&#x914D;&#x5668;&#x6A21;&#x5F0F;&#x5C31;&#x53EF;&#x4EE5;&#x7528;&#x5F97;&#x4E0A;&#x4E86;&#x3002;</p>
<p>&#x800C;&#x4E14;&#x968F;&#x7740;&#x5F00;&#x53D1;&#x5F80;&#x540E;&#xFF0C;&#x518D;&#x6709;&#x4E0E;&#x4E00;&#x671F;&#x7C7B;&#x4F3C;&#x7684;&#x63A5;&#x53E3;&#x90FD;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x9002;&#x914D;&#x5668;&#x6765;&#x517C;&#x5BB9;&#x3002;</p>
<p>&#x6BD4;&#x5982;&#x8BF4;&#x73B0;&#x5728;&#x6709;&#x4E24;&#x4E2A;&#x529F;&#x80FD;&#x662F;&#x76F8;&#x7C7B;&#x4F3C;&#x7684;&#xFF0C;&#x626B;&#x7801;&#x79DF;&#x8F66;&#xFF0C;&#x4E0A;&#x9501;&#x8FD8;&#x8F66;</p>
<h3 id="&#x6269;&#x5C55;---&#x53CC;&#x5411;&#x9002;&#x914D;&#x5668;">&#x6269;&#x5C55;---&#x53CC;&#x5411;&#x9002;&#x914D;&#x5668;</h3>
<p>&#x9002;&#x914D;&#x8005;&#x5373;&#x53EF;&#x4EE5;&#x628A;&#x9002;&#x914D;&#x8005;&#x63A5;&#x53E3;&#x8F6C;&#x6362;&#x6210;&#x76EE;&#x6807;&#x63A5;&#x53E3;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x628A;&#x76EE;&#x6807;&#x63A5;&#x53E3;&#x8F6C;&#x6362;&#x6210;&#x9002;&#x914D;&#x8005;&#x63A5;&#x53E3;</p>
<p><img src="http://c.biancheng.net/uploads/allimg/181115/3-1Q115104Q1604.gif" alt=""></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../proxymode/" class="navigation navigation-prev " aria-label="Previous page: 代理模式">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../bridgemode/" class="navigation navigation-next " aria-label="Next page: 桥接模式">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"适配器模式","level":"2.1.2.2","depth":3,"next":{"title":"桥接模式","level":"2.1.2.3","depth":3,"path":"Design-Patterns/src/main/java/structuredmodel/bridgemode/README.md","ref":"Design-Patterns/src/main/java/structuredmodel/bridgemode/README.md","articles":[]},"previous":{"title":"代理模式","level":"2.1.2.1","depth":3,"path":"Design-Patterns/src/main/java/structuredmodel/proxymode/README.md","ref":"Design-Patterns/src/main/java/structuredmodel/proxymode/README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["expandable-chapters","livereload"],"pluginsConfig":{"expandable-chapters":{},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Design-Patterns/src/main/java/structuredmodel/adaptermode/README.md","mtime":"2019-07-08T11:05:14.979Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-09-09T07:20:35.937Z"},"basePath":"../../../../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../../../../gitbook/gitbook.js"></script>
    <script src="../../../../../../gitbook/theme.js"></script>
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

